<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Turn it Around</title>

</head>
<body>
<div class="bodyreportabuse">
<div class="reportabuse">
<form id="report_abuse_form" method="post" action="">
<h3>Report Abuse</h3>
<p>Unhappy with this news story, photos or comment on this website? Then tell us about it here.</p>
<label>Your Name: <sup>*</sup></label><br />
<input type="text" id="name" name="name"  value="Your Name" /><br />
<label>Your E-mail: <sup>*</sup></label><br />
<input type="text" id="email" name="email" value="E-mail Address" /><br />
<label>Your Comment: <sup>*</sup></label><br />
<textarea id="your_comment" name="your_comment">I am not happy with this story or comment because...</textarea><br />
<hr />

<?php echo $captcha['image']; ?><br /><br />
<label>Spam Prevention: <sup>*</sup></label>
<input class="spam" type="text" name="confirmCaptcha" id="confirmCaptcha" />
<?php //echo $debug?>
<hr />
<!--<button>Submit</button>-->
<input type="submit" value="Submit" />
</form>
<div id="fb-root"></div>
</div><!-- reportabuse -->
</div><!-- bodyreportabuse -->
<script>
$(document).ready(function(){
	$.fancybox.resize();
	//alert('Hi');
    $('#name').each(function(){
        var default_value = this.value;
        $(this).focus(function() {
            if(this.value == default_value) {
                this.value = '';
            }
        });
        $(this).blur(function() {
            if(this.value == '') {
                this.value = default_value;
            }
        });
    });
    $('#email').each(function(){
        var default_value_first = this.value;
        $(this).focus(function() {
            if(this.value == default_value_first) {
                this.value = '';
            }
        });
        $(this).blur(function() {
            if(this.value == '') {
                this.value = default_value_first;
            }
        });
    });
    $('#your_comment').each(function(){
        var default_value_two = this.value;
        $(this).focus(function() {
            if(this.value == default_value_two) {
                this.value = '';
            }
        });
        $(this).blur(function() {
            if(this.value == '') {
                this.value = default_value_two;
            }
        });
    });
	$('#report_abuse_form').validate({
        rules : {
            name : {
                required : true
            },
            email : {
                required : true,
                email : true
            },
            your_comment : {
                required : true
            }
        } ,
        messages: {
            name: "Please enter your name",
            your_comment: "Please enter the problem",
            email: { 
                required : "Please enter your E-mail",                                         
                email : "Please enter Valid E-mail"                                         
            }  
	    },
	    errorClass: "erroribnu",
	    submitHandler: function() {
	    submit_report_abuse();
	    }
	});	
});
function submit_report_abuse(){
    $.fancybox.showActivity();
    $.post("<?php echo site_url('news/send_abuse'); ?>",
	{
		"submit":"submit",
		"name":$('#name').val(),
		"comment":$('#your_comment').val(),		
		"email":$('#email').val(),
		"report_id":<?php echo $id_report?>,
		"confirm_captcha":$('#confirmCaptcha').val()        
	}
	,function(data){
	    data = $.parseJSON(data);
	    if(data.status == 'success'){
		$.fancybox.hideActivity();
		$.fancybox({
		    'content':data.content
		});
	    }else{
		$.fancybox.hideActivity();
		$.fancybox(data.content);
	    }
	    //var result = $.fancybox(data);
	    //$.fancybox.close();
    });
}
</script> 
</body>
</html>